package com.xinhe.cn.cpbox.utils;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Date;

/*
 * @author yekai
 * @date 2020/6/15 15:53
 */
@Slf4j
public class DateUtils {
    public static String getNowDate() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(new Date());
    }

    public static int getday(String birthday) {
        return DateUtil.ageOfNow(birthday);
    }

    public static int getDaySub(String day) {
        long between = DateUtil.between(DateUtil.parse(DateUtil.parse(day).toDateStr()), DateUtil.parse(DateUtil.now()), DateUnit.DAY);
        return (int) between;

    }

    public static String getDate() {
        DateTime dateTime = DateUtil.tomorrow();
        return DateUtil.format(dateTime, "yyyy-MM-dd");
    }





}
